package org.vergil.config;

import com.google.common.eventbus.EventBus;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.vergil.core.guava.Thread.GetThread;
import org.vergil.core.guava.Thread.SetThread;

/**
 * Created by vergil on 4/23/17.
 */
@Configuration
public class ThreadConfig {

    @Bean
    public EventBus eventBus(){
        return new EventBus();
    }

    @Bean
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public GetThread getThread(){
        return new GetThread(eventBus());
    }

    @Bean
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public SetThread setThread(){
        return new SetThread(eventBus());
    }
}
